<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="probiz" tagdir="/WEB-INF/tags/probiz"%>
<%@ taglib prefix="other" tagdir="/WEB-INF/tags/other"%>
<probiz:pageHeading pageHeadingKey="giftList.heading" />
<content tag="buttons">
	<authorize:authorizeResource resourceString="/sales/gift*direct=add">
	<probiz:iconBtn btnType="add" onclick="createGift();" />
	</authorize:authorizeResource>
	<authorize:authorizeResource resourceString="/sales/gift.html?doAction=*elete*">
		<probiz:iconBtn btnType="delete" id="multiDelete" onclick="deleteGifts();" />
	</authorize:authorizeResource>
</content>

<div id="giftList">
	<%@include file="include/giftSearchCriteria.jspf"%>
	
		<div class="tree">
			<div class="tree_wrap">
				<div class="hd"></div>
					<div class="content" id="categoryTree">
						<%@ include file="../catalog/include/giftCategoryTreeBody.jspf"%>
					</div>
				<div class="ft"></div>
			</div>
		</div>
		<div class="tree_r">
			<div id="giftResults" name="giftResults" class="tree_r_wrap">
				<%--ajaxLoad file="/salse/include/giftListBody.jsp" --%>
			</div>
		</div>
</div>

<%-----giftForm的div在装饰器中----%>

<%-----start:list需要加载的JS ----%>
<c:set var="plugin_tree" value="true" scope="request"/>
<script type="text/javascript"	src="${ctxPath}/scripts/probiz/sales/giftList.js?rs=${appConfig.rs}"></script>
<%-----end:  list需要加载的JS ----%>

<%-----start:form需要加载的JS ----%>
<c:set var="plugin_upload" value="true" scope="request"/>
<c:set var="plugin_htmlEditor" value="true" scope="request"/>
<c:set var="ui_dialog" value="true" scope="request"/>
<c:set var="ui_tabs" value="true" scope="request"/>
<c:set var="ui_datepicker" value="true" scope="request"/>
<script type="text/javascript"	src="${ctxPath}/scripts/probiz/sales/giftForm.js?rs=${appConfig.rs}"></script>
<%-----end:  form需要加载的JS ----%>

<c:if test="${not empty param.direct}">
	<c:set var="hideMainDiv" value="true" scope="request"/>
</c:if>
<script type="text/javascript">
$j(document).ready(function () {
	__FMTExtend = {
		form_select_all:"<fmt:message key="common.message.select.all"/>",
		giftList_selectGift:"<fmt:message key="giftList.selectGift"/>",
		gift_label:"<fmt:message key="gift.label"/>",
		gift_delete_false:"<fmt:message key="gift.delete.false"/>",
	    gift_delete_success:"<fmt:message key="gift.delete.success"/>",
	    gift_delete_logical:"<fmt:message key="gift.delete.logical"/>",
	    giftForm_save_success:"<fmt:message key="giftForm.save.success"/>",
	    giftForm_waitImagesLoaded:"<fmt:message key="giftForm.waitImagesLoaded"/>"
	};
	$j.extend(__FMT, __FMTExtend); 		
});

$j(document).ready(function () {
	searchGifts(true,'');
	jCategoryTree = $j('#categoryTree > ul').simpleTree({
		drag:false,
		afterClick:function(node){
			clickTreeItemAction();
		},
		afterDblClick:function(node){
		},
		afterMove:function(destination, source, pos){
		},
		afterAjax:function()
		{
		},
		animate:true
		//,docToFolderConvert:true
	})[0];
	$j("#categoryTree").show();
	
	<c:if test="${(not empty param.direct) and (param.direct == 'add')}">
		createGift();
	</c:if>
	
	<c:if test="${not empty param.giftId}">
		editGift(${param.giftId});
	</c:if>

});

</script>
